import request from '@/utils/request'
// 收货单管理列表 -----------------------------------------------------------
export function receiveList(listQuery) {
  return request({
    url: '/wms/receive',
    method: 'get',
    params: listQuery
  })
}
// 提交
export function receiveCheckSubmit(data) {
  return request({
    url: '/wms/receive/check',
    method: 'post',
    data
  })
}
// 保存
export function receiveSaveSubmit(data) {
  return request({
    url: '/wms/receive/save',
    method: 'post',
    data
  })
}
// 获取商品单位换算详情
export function goodsUnitConversion(code) {
  return request({
    url: `/wms/goodsUnitConversion/${code}`,
    method: 'get'
  })
}
// 收货
export function receiveCheckIn(code) {
  return request({
    url: `/wms/receiveItem/itemWithRegisterList`,
    method: 'get',
    params: { receiveCode: code }
  })
}
// 获取收货明细
export function getRegisterList(params) {
  return request({
    url: `/wms/receiveItem/itemWithRegisterListByPaging`,
    method: 'get',
    params
  })
}
// 取消收货
export function receiveCheckOut(code) {
  return request({
    url: `/wms/receiveItem/itemWithRegisterList`,
    method: 'get',
    params: { receiveCode: code }
  })
}

// 获取收货登记详情
export function getReceiveRegister(code) {
  return request({
    url: `/wms/receiveItem/register/${code}`,
    method: 'get'

  })
}
// 收货登记提交
export function receiveRegisterAdd(data) {
  return request({
    url: '/wms/receiveRegister',
    method: 'post',
    data
  })
}

// 获取 可退货明细 列表
export function getRefundOutItems(code) {
  return request({
    url: '/wms/receive/findRefundOutItems',
    method: 'get',
    params: { deliveryCode: code }
  })
}
// 获取来源单号
export function getSource(params) {
  return request({
    url: `/wms/delivery/findCanRefundList`,
    method: 'get',
    params
  })
}

// 收货完成
export function receive(data) {
  return request({
    url: '/wms/receive/finishReceiveInfo',
    method: 'put',
    data
  })
}
// 部分收货
export function partialReceipt(data) {
  return request({
    url: '/wms/receive/partFinishReceiveInfo',
    method: 'put',
    data
  })
}
// 确认取消收货
export function finishReceive(data) {
  return request({
    url: '/wms/receive/finishCancelReceive',
    method: 'put',
    data
  })
}

// 作废
export function receiveBlank(code) {
  return request({
    url: '/wms/receive/blank',
    method: 'put',
    params: { codes: code }
  })
}

// 修改详情
export function receiveUpdateDetail(code) {
  return request({
    url: `/wms/receive/${code}`,
    method: 'get'
  })
}
// 打印详情
export function receivePrintDetail(code) {
  return request({
    url: `/wms/receive/getDetailWithRegister/${code}`,
    method: 'get'
  })
}

// 查看详情
export function receiveDetail(code) {
  return request({
    url: `/wms/receive/getDetailWithRegister/${code}`,
    method: 'get'
  })
}

// 上架单管理列表 -----------------------------------------------------------
export function putawayList(listQuery) {
  return request({
    url: '/wms/putaway',
    method: 'get',
    params: listQuery
  })
}
// 详情
export function putawayDetail(code) {
  return request({
    url: `/wms/putaway/${code}`,
    method: 'get'
  })
}
// 提交
export function putawayCheckSubmit(data) {
  return request({
    url: '/wms/putaway/check',
    method: 'post',
    data
  })
}
// 保存
export function putawaySaveSubmit(data) {
  return request({
    url: '/wms/putaway/save',
    method: 'post',
    data
  })
}

// 入库单管理列表 -----------------------------------------------------------
export function inboundList(listQuery) {
  return request({
    url: '/wms/inbound',
    method: 'get',
    params: listQuery
  })
}
// 详情
export function inboundDetail(code) {
  return request({
    url: `/wms/inbound/${code}`,
    method: 'get'
  })
}
// 一键收货
export function quickReceive(data) {
  return request({
    url: '/wms/receiveRegister/batchCreate',
    method: 'post',
    data
  })
}
